﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TicketMovie.Admin
{
    public partial class WebForm11 : System.Web.UI.Page
    {
        private DataClasses1DataContext dc = new DataClasses1DataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            this.RepeaterRoom.DataSource = this.dc.Rooms.ToList();
            this.RepeaterRoom.DataBind();
        }
        protected void LinkButtonDeleteRoom_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton lb = (LinkButton)sender;
                HiddenField hf = (HiddenField)lb.Parent.FindControl("HiddenFieldDelRoom");
                Room roo = this.dc.Rooms.Single(ro => ro.code_room == Convert.ToString(hf.Value));
                this.dc.Rooms.DeleteOnSubmit(roo);
                this.dc.SubmitChanges();
                this.message_error.Visible = false;
                this.message_thanhcong.Visible = true;
            }
            catch
            {
                this.message_error.Visible = true;
                this.message_thanhcong.Visible = false;
            }
            this.RepeaterRoom.DataSource = this.dc.Rooms.ToList();
            this.RepeaterRoom.DataBind();
        }
    }
}